package cpuSched;

import java.awt.CardLayout; 
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
 
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;

import cpuSched.CPUPanel; 
import Main.FileReader;

public class CPUMainPanel extends JPanel {
	private JPanel parent;
	private CardLayout cards;
	private FileReader fr;
	public CPUMainPanel(JPanel parent, CardLayout cards, FileReader fr){
		this.fr=fr;
			this.setLayout(null);
		this.parent=parent;
		this.cards=cards;
		
		CardLayout cpuCl = new CardLayout();
		JPanel cpuParent=new JPanel(cpuCl);
		cpuParent.add(this, 4+"");
		cpuCl.show(cpuParent, 4+"");
		
		JButton back = new JButton("Back to Simulation");
		back.setBounds(15, 10, back.getPreferredSize().width, 30);
		back.addActionListener(new AL());
		
		CPUPanel cpuPanel = new CPUPanel(fr);
		JScrollPane sp = new JScrollPane(cpuPanel);
		cpuPanel.setSP(sp);
		TimerPanel timePanel = new TimerPanel();
		timePanel.setBounds(1017, 58, 100, 100);
		sp.setBounds(17, 55, 950, 120);
		this.add(timePanel);
		this.add(sp);
		this.add(back);
		
	}
	class AL implements ActionListener{

		@Override
		public void actionPerformed(ActionEvent arg0) {
			// TODO Auto-generated method stub
			cards.show(parent, 3+"");
			
		}
		
	}
}
